package com.leizi.igym;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

/**
 * @Author: leizi0110
 * @CreateTime: 2024-04-20  22:56
 * @Description:
 */
@ToString
@Data
@NoArgsConstructor
@AllArgsConstructor
@Document(indexName = "leizi")
public class ESUser {

    @Id
    private Long id;

    @Field(type = FieldType.Integer)
    private Integer age;

    @Field(type = FieldType.Keyword,index = false)
    private String email;

    @Field(type = FieldType.Keyword,analyzer = "ik_smart")
    private String info;

    @Field(type = FieldType.Object)
    private name name;


    @Data
    @NoArgsConstructor
    @AllArgsConstructor
    @ToString
    static
    class name{
        @Field(type = FieldType.Keyword)
        private String firstName;

        @Field(type = FieldType.Keyword)
        private String lastName;
    }
}
